Use and Learn React without Install | Vite code editor
Learn React online using the Vite code editor – no setup needed!
Step 1: Open Vite Online Editor
- Go to 👉 vite.dev
- Click on the link to “Playground” or Vite Code Editor
- It will open a React project that runs directly in your browser
Now you’re ready to start coding – just like in VS Code!
Step 2: Edit App.jsx
Go to src/App.jsx
and replace the existing code with:
<h1>Hello React</h1>
Create a New Component
- Inside the
src
folder, create a file calledUser.jsx
- Add the following code:
function User() {
return <h1>User Component</h1>;
}
export default User;
Now import the User
component into App.jsx
import User from './User';
function App() {
return (
<>
<h1>Hello React</h1>
<User />
</>
);
}
Create a Counter with useState
Now let’s add a simple counter to learn about React state:
import { useState } from 'react';
import User from './User';
function App() {
const [counter, setCounter] = useState(0);
return (
<>
<h1>Counter Value: {counter}</h1>
<User />
<button onClick={() => setCounter(counter + 1)}>
Increase Counter
</button>
</>
);
}
Now click the button and see your counter increase live!
That’s It!
You just used:
- A React component
- The useState hook
- Vite’s online editor — no install needed!